<?php
require_once('../../controller/auth.php');
//Start session
	session_start();
	
	//Include database connection details
	require_once('../../controller/inc/config.inc');
	
	
	
	//Connect to mysql server
	$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
	if(!$link) {
		die('Failed to connect to server: ' . mysql_error());
	}
	
	//Select database
	$db = mysql_select_db("ttc_teachers");
	if(!$db) {
		die("Unable to select database");
	}
$prov_id=$_POST['pro_id'];
mysql_query ('SET NAMES utf8');
mysql_query('SET CHARACTER_SET utf8');

echo "<h5>In this selected TTC:</h5>";
$qcm=mysql_query("SELECT TTC_TYPE,COUNT(*) FROM ttc_information WHERE PROV_ID='$prov_id' group by TTC_TYPE");

$counter=0;
$arr=Array('No of Main TTCs','No of Sub TTCs','No of Satelite TTCs');
echo "<table class='table table-bordered' style='width:50%'>";
while($qcm_row=mysql_fetch_array($qcm)){
echo "<th class='success'>" . $arr[$counter] . "</th><td class='success'>" . $qcm_row[1] . "</td>";
echo "</tr>";
$counter++;
}	
echo "</table>";
echo "<h4>Detailed Information</h4>";	  	
$q=mysql_query("SELECT * FROM ttc_information WHERE PROV_ID='$prov_id'");
echo "<table class='table table-bordered table-striped'>";
echo "<thead><tr class='info'><th>TTC ID</th><th>TTC Name</th><th>TTC Type</th><th>TTC Status</th><th>TTC Location</th><th colspan=2>Action</th></tr><thead>";
while($ttc=mysql_fetch_array($q)){
	echo "<tbody><tr>";
	echo "<td>" . $ttc['TTC_ID'] . "</td><td>" . $ttc['TTC_NAME'] . "</td><td>" . $ttc['TTC_TYPE'] . "</td><td>" . $ttc['TTC_STATUS'] . "</td><td>" . $ttc['TTC_LOCATION'] . "</td><td align='center'><a href='edit_ttc.php?id=$ttc[TTC_ID]'><i class='icon-pencil'></i></a></td><td><a href='delete_ttc.php?id=$ttc[TTC_ID]'><i class='icon-trash'></i></a></td>";
	echo "</tr></tbody>";
	
	}
echo "</table>";

?>